﻿/* 
 *  <copyright file="Wiggle.cs" company="Wesley Jowitt">
 *  
 *  SobrietyEngine: Copyright (c) 2011 Wesley Jowitt
 *  
 *  This software is distributed under a software license.
 *   * As of the creation time of this file, the license in use is the Microsoft Permissive License (Ms-PL) 
 *    * The license can be viewed at:
 *     * License.Txt in the root folder of this project
 *      * http://sobrietyengine.codeplex.com/license
 *       * http://www.microsoft.com/opensource/licenses.mspx
 *       
 *  </copyright>
 *   */

using System;
using System.Collections.Generic;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna;

namespace SobrietyEngine.Components.Shaders.Pixel
{
    public class Wiggle: BaseShader, IComponent, IShader
    {
        float timer = 0.0f;

        public Wiggle():base()
        {
        }

        public Wiggle(Effect effect)
            : base(effect)
        {
        }

        public override void UpdatePass(GameTime elapsedTime, int pass)
        {
            timer += (float)elapsedTime.ElapsedGameTime.Milliseconds / 500;
            if (timer > 4)
                timer -= 6.28f;
            Effect.Parameters["fTimer"].SetValue(timer);
            base.Update(elapsedTime);
        }
    }
}
